package com.magic233.config.interceptor;

import com.magic233.interceptor.AdminInterceptor;
import com.magic233.interceptor.WorkerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * ClassName: Worker
 * Description:
 * date: 2021/5/30 14:27
 * author: zouyuan
 */
@Configuration
public class Worker implements WebMvcConfigurer {

    @Bean
    public WorkerInterceptor getWorkerInterceptor() {
        return new WorkerInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] addPathPatterns = {
                "/worker/**"
        };

        registry.addInterceptor(getWorkerInterceptor()).addPathPatterns(addPathPatterns);
    }
}
